<%@ taglib uri="http://java.sun.com/portlet" 		prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" 	prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 	prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" 	prefix="c_rt"%>

<%@ page import="javax.portlet.RenderRequest" %>
<%@ page import="javax.portlet.RenderResponse" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<%@ page import="org.apache.jetspeed.login.LoginConstants"%>
<%@ page import="org.apache.jetspeed.request.RequestContext"%>
<%@ page import="pl.edu.agh.portal.application.utils.PortletsUtils" %>

<%@ page session="false" %>

<portlet:defineObjects/>
<% 
	PortletPreferences preferences = renderRequest.getPreferences();
	String loginStatus = preferences.getValue(PortletsUtils.LOGIN_STATUS, PortletsUtils.NO_LOGIN);
%>

<% if(loginStatus.equals(PortletsUtils.NO_LOGIN) || loginStatus.equals(PortletsUtils.INVALID_LOGIN)) { %>


<% } %>
	<% if (loginStatus.equals(PortletsUtils.INVALID_LOGIN)) { %>
		<b><font color="red">Login failed!!!</font></b>
	<% } %> 
	<div align="center">		
		<form method="POST" action='<portlet:actionURL/>'>
      		<table border="0">
		    	<tr>	
			        <td>Login: </td>
			        <c_rt:set var="userName" value="<%=((RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV)).getSessionAttribute(LoginConstants.USERNAME)%>"/>
			        <td><input type="text" size="30" name="<%=LoginConstants.USERNAME%>" value="<c:out value="${userName}"/>"></td>
      			</tr>
      			<tr>
        			<td>Haslo: </td>
        			<td><input type="password" size="30" name="<%=LoginConstants.PASSWORD%>"></td>
      			</tr>
      			<tr>
        			<td colspan="2"><input type="submit" value="Zaloguj"></td>
      			</tr>
      		</table>
    	</form>
	</div>
		

